//package com.travel.travelServer.service1.impl;
//
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
//import com.travel.travelServer.entity1.LoginUser;
//import com.travel.travelServer.entity1.User;
//import com.travel.travelServer.mapper1.UserMapper;
//import org.springframework.security.core.userdetails.UserDetails;
//import org.springframework.security.core.userdetails.UserDetailsService;
//import org.springframework.security.core.userdetails.UsernameNotFoundException;
//import org.springframework.stereotype.Service;
//
//import javax.annotation.Resource;
//import java.util.Objects;
//
//@Service
//public class LoginUserServiceImpl implements UserDetailsService {
//
//    @Resource
//    private UserMapper userMapper;
//
//    @Override
//    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
//        LambdaQueryWrapper<User> userWrapper = new LambdaQueryWrapper<>();
//        userWrapper.eq(User::getUsername, username);
//        User dbUser = userMapper.selectOne(userWrapper);
//        if (Objects.isNull(dbUser)){
////            throw new ServiceException("用户名错误!");
//        }
//        return new LoginUser(dbUser);
//    }
//}
